
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "SSKeychain.h"

/**
 App名字
 */
NS_INLINE NSString * _Nullable lanB_AppName() {
    return [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleNameKey];
}

/**
 App包名
*/
NS_INLINE NSString * _Nullable lanB_BundleId() {
    return [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey];
}

/**
 App版本号
*/
NS_INLINE NSString * _Nullable lanB_VersionNum() {
    return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
}

/**
 App构建版本号
*/
NS_INLINE NSString * _Nullable lanB_BuildNum() {
    return [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey];
}

/**
 屏宽
*/
NS_INLINE CGFloat lanB_SCREEN_WIDTH() {
    return [UIScreen mainScreen].bounds.size.width;
}

/**
 屏高
*/
NS_INLINE CGFloat lanB_SCREENH_HEIGHT() {
    return [UIScreen mainScreen].bounds.size.height;
}

/**
 屏幕size
*/
NS_INLINE CGSize lanB_SCREEN_SIZE() {
    return [UIScreen mainScreen].bounds.size;
}

/**
 状态栏 size
*/
NS_INLINE CGSize lanB_StatusBar_SIZE() {
    return [UIApplication sharedApplication].statusBarFrame.size;
}

/**
 navbar size
*/
NS_INLINE CGSize lanB_NavBar_SIZE(UINavigationController *nav) {
    return nav.navigationBar.frame.size;
}

/**
 判断是否刘海屏
*/
NS_INLINE BOOL lanB_ISIPHONE_X() {
    return ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? ((NSInteger)(([[UIScreen mainScreen] currentMode].size.height/[[UIScreen mainScreen] currentMode].size.width)*100) == 216) : NO);
}

/**
 导航栏高度
*/
NS_INLINE CGFloat lanB_NavHeight() {
    return lanB_ISIPHONE_X() ? 88 : 64;
}

/**
 tabbar高度
*/
NS_INLINE CGFloat lanB_TabHeight() {
    return lanB_ISIPHONE_X() ? 83.f : 49.f;
}

/**
 tabbar 安全 高度
*/
NS_INLINE CGFloat lanB_TabSafeBootom() {
    return lanB_ISIPHONE_X() ? 34.f : 0.f;
}

/**
 设备UUID
*/
NS_INLINE NSString * _Nonnull lanB_DeviceUUID() {
    NSString *deviceUUID = [SSKeychain passwordForService:lanB_BundleId() account:@"deviceUUID"];
    if (!deviceUUID) {
        deviceUUID = [[UIDevice currentDevice].identifierForVendor UUIDString];
        [SSKeychain setPassword:deviceUUID forService:lanB_BundleId() account:@"deviceUUID"];
    }
    return deviceUUID;
}
